Compatibility with anndata 0.13 - #88
Conversation
Delegate anndata.acc accessor indexers (AdRef, MapAcc, RefAcc) from TreeData.__getitem__ to AnnData.__getitem__ instead of routing them through _normalize_indices, fixing an "IndexError: Unknown indexer" from obs_vector/var_vector under anndata >= 0.13. Bump the floors to anndata>=0.13 and zarr>=3 (anndata 0.13 requires Python >=3.12 and no longer supports zarr <3), and remove the now-dead anndata<0.11 (USE_EXPERIMENTAL) and zarr<3 (ZARR_V2) code branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f0959ae12
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { name = "William Colgan" }, | ||
| ] | ||
| requires-python = ">=3.11" | ||
| requires-python = ">=3.12" |
There was a problem hiding this comment.
Remove Python 3.11 from the test matrix
With this floor bump, the hatch matrix still contains Python 3.11 at pyproject.toml:78, and .github/workflows/test.yaml reads that matrix and creates every listed environment. That schedules a hatch-test job under Python 3.11 for each PR, but an editable install of this project is invalid once requires-python is >=3.12, so the required test workflow will fail before running tests. Please update the matrix's lowest Python to 3.12 or remove the 3.11 entry along with this change.
Useful? React with 👍 / 👎.
Summary
Makes
treedatacompatible with anndata 0.13.TreeData.__getitem__for the newanndata.accaccessor. In 0.13,obs_vector/var_vector(and anyvar_names/layer column lookup) are reimplemented on top of theaccaccessor:AnnData.obs_vector(k)builds anAdRefand callsadata[ref].TreeData.__getitem__overrodeAnnData.__getitem__and sent theAdRefstraight into_normalize_indices, raisingIndexError: Unknown indexer A.X[:, '1']. It now delegates accessor-type indexers (AdRef,MapAcc,RefAcc) toAnnData.__getitem__(which returns the array/vector) and only builds aTreeDataview for real index slices.anndata>=0.13(which requires Python>=3.12) andzarr>=3(anndata 0.13 dropped zarr <3 support).anndata<0.11(USE_EXPERIMENTAL) paths inread.py/write.pyand thezarr<3(ZARR_V2) paths inwrite.py, along with their unused imports.Verification
Full suite (58 tests) passes on both:
Confirmed under 0.13 that
obs_vector/var_vector(incl.layer=) return correct columns, normal slicing still returns aTreeDataview, and zarr (incl. ZipStore + large-tree) and h5td backed/non-backed round-trips all pass.I also reviewed the other 0.13 breaking changes (X→
layers[None], zarr v3 autosharding default, backed sparse,__setitem__/__delitem__removal, h5ad forward-slash keys, nullable strings) and confirmed treedata either already handles them or is unaffected — no further code changes were needed.🤖 Generated with Claude Code